<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSettingRepayRatesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('setting_repay_rates', function (Blueprint $table) {
            $table->charset = 'utf8';
            $table->collation = 'utf8_general_ci';
            $table->comment = '还款的费率表';
            $table->increments('id');
            $table->string('channel_code',127)->index()->comment('资金方编号,和setting_channel表进行关联');
            $table->unsignedInteger('period')->default(1)->comment('期数');
            $table->unsignedDecimal('lending_rate',8,4)->default(0)->comment('贷款费率');
            $table->unsignedDecimal('insurance_rate',8,4)->default(0)->comment('前置保险费');
            $table->unsignedDecimal('month_insurance_rate',8,4)->default(0)->comment('月保险费率');
            $table->unsignedDecimal('manage_rate',8,4)->default(0)->comment('管理费率');
            $table->unsignedDecimal('repayment_rate',8,4)->default(0)->comment('提前还清手续费');
            $table->unsignedDecimal('fines_rate',8,4)->default(0)->comment('逾期罚息利率');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('setting_repay_rates');
    }
}
